You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Classes > TMtxInt Class > TMtxInt Methods > TMtxInt.Diag Method
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
TMtxInt.Diag Method

Sets the matrix diagonal to values from the vector.

Syntax
C#
Visual Basic
public TMtxInt Diag([In] TVecInt Vec, int k);

Sets the k-th diagonal of the calling matrix to values from from the Vec object. If k = 0 then the main diagonal matrix is set, if k < 0 then the k-th subdiagonal matrix is set and if k > 0 the then the k-th super diagonal is set. The matrix must be large enough to hold diagonal or an exception is raised.

var A: TMtxInt; D: TVecInt; begin CreateIt(A); CreateIt(D); try A.SetIt(2,2,[1,1, 1,2]); D.SetIt([3,4]); A.Diag(D,0); // A becomes: // [3,1] // [1,4] finally FreeIt(D); FreeIt(A); end; end;
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!